<!DOCTYPE html>
<html ng-app="demoApp" ng-controller="DemoCtrl">
    <head>
        <meta charset="utf-8">
        <title>angular-clipboard demo</title>
    </head>
    <body>

        <h1>Click button to copy text to clipboard</h1>

        <p>
            <textarea ng-model="textToCopy" rows="5" cols="30"></textarea><br />
            <button clipboard text="textToCopy" on-copied="success()" on-error="fail(err)">Copy</button>
        </p>

        <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.5/angular.js"></script>
        <script src="../angular-clipboard.js"></script>
        <script>
            var demoApp = angular.module('demoApp', ['angular-clipboard']);

            demoApp.controller('DemoCtrl', ['$scope', function ($scope) {
                $scope.textToCopy = "I can copy by clicking!\nAnd also new lines!";

                $scope.success = function () {
                    console.log('Copied!');
                };

                $scope.fail = function (err) {
                    console.error('Error!', err);
                };
            }]);
        </script>
    </body>
</html>
